package fr.inserm.umr915.vcfannotator.io;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import org.springframework.core.io.InputStreamSource;

public class BlockCompressedInputStreamSource
	implements InputStreamSource
	{
	private InputStreamSource delegate;
	
	public BlockCompressedInputStreamSource(String url) throws MalformedURLException
		{
		this(new URL(url));
		}
	
	public BlockCompressedInputStreamSource(URL url)
		{
		this.delegate=new org.springframework.core.io.UrlResource(url);
		}
	
	public BlockCompressedInputStreamSource(InputStreamSource delegate)
		{
		this.delegate=delegate;
		}
	
	public InputStreamSource getDelegate()
		{
		return delegate;
		}
	
	@Override
	public InputStream getInputStream() throws IOException
		{
		return new net.sf.samtools.util.BlockCompressedInputStream(getDelegate().getInputStream());
		}
	}
